<template>
  <el-dialog :title="title" :close-on-click-modal="false" :fullscreen="true" :visible.sync="visible"
    :before-close="cancel" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="50%">
    <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">
        <el-col :span="8">
          <el-form-item label="账户编号" prop="FBILLNO">
            <el-input v-model="dataForm.FBILLNO"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="建帐日期" prop="FBILLCREDATE">
            <el-date-picker v-model="dataForm.FBILLCREDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="8">
            <el-form-item label="账户状态">
              <el-select v-model="dataForm.FBILLSTATE" placeholder="请选择" disabled>
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="8">
          <el-form-item label="账户姓名" prop="FCATNAME">
            <el-input v-model="dataForm.FCATNAME"   />
          </el-form-item>
        </el-col>

       <el-col :span="8">
          <el-form-item label="身份证号" prop="FCATNO">
            <el-input v-model="dataForm.FCATNO"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="学生人数" prop="FNUM">
            <el-input v-model="dataForm.FNUM"   />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="联系方式" prop="FNUM">
            <el-input v-model="dataForm.FNUM"   />
          </el-form-item>
        </el-col>

        <el-col :span="16">
          <el-form-item label="联系地址" prop="FMEMO">
            <el-input v-model="dataForm.FMEMO"   />
          </el-form-item>
        </el-col>
        
        <el-col :span="5">
          <el-form-item label="">
            <!-- <el-button type="success" icon="el-icon-plus" @click="insert">添加场地</el-button> -->
            <el-button type="primary" :loading="loading" @click="closePage">返回</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>

    <template>
     <el-tabs v-model="activeName" type="card" @tab-click="handleClick">

      <el-tab-pane label="缴费记录" name="one">
        <el-table :data="list2" border stripe>
          <!-- <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" 
                type="text">删除</el-button>
            </template>
          </el-table-column> -->
          <el-table-column prop="FENTRYID"FDATE label="序号" width="65" ></el-table-column>
          <el-table-column prop="FUNIT" label="缴费日期"   ></el-table-column>
          <el-table-column prop="FCATNAME" label="收费项目" ></el-table-column>
          <el-table-column prop="FPRICE" label="单价" width="95"></el-table-column>
          <el-table-column prop="FQTY" label="数量"  width="90"></el-table-column>
          <el-table-column prop="FAMT" label="小计" width="110"></el-table-column>
          <el-table-column prop="FMEMO" label="备注"></el-table-column>
       </el-table>
        <div class="addbox">
             <el-link icon="el-icon-plus" type="primary" >添加一行</el-link>
        </div>
      </el-tab-pane>

      <el-tab-pane label="学生列表" name="two">
        <el-table :data="list1" border stripe>
          <!-- <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
          </el-table-column> -->
          <el-table-column prop="FENTRYID"FDATE label="序号" width="85" ></el-table-column>
          <el-table-column prop="FCATNAME" label="学生姓名"  ></el-table-column>
          <el-table-column prop="FCATNO" label="身份证"  ></el-table-column>
          <el-table-column prop="FNOTE" label="学校名称"  ></el-table-column>
          <el-table-column prop="FMEMO" label="备注"></el-table-column>
       </el-table>
        <!-- <div class="addbox">
             <el-link icon="el-icon-plus" type="primary" >添加一行</el-link>
        </div> -->
      </el-tab-pane>
   
    </el-tabs>
    
   </template>

    <StudqueryFcuston ref="StudqueryFcuston" @confirm="shoplist" />
  </el-dialog>
</template>
<script>
  import StudqueryFcuston from "@/components/StudqueryFcuston/StudqueryFcuston.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    components: { StudqueryFcuston },
    props: {
      formationlist: {
        type: Array,
        default: [],
      },
    },
    data() {
      return {
        activeName: 'one',

        textarea1:"学校包车",
        textarea2:"当天来回,没有住宿",
        textarea3:"午餐在好福气大饭店",

        title: "新增",
        insertorupdate: true,
        dataForm: {
            FBILLNO: "Y241130002", 
            FBILLCREDATE:"2024-12-13",
            FUSER: "汉武帝",
            FSCHOOL: "闵行莘城中学",
            FCATNAME: "曹操",
            FPOINT:"上海国际汽车城",
            FBEGDATE: "2025-03-15",
            FENDDATE:"2025-03-17",
            FCLASS:"初一",
            FNUM:250,
            FMONEY:500,
            FMEMO: "3天2夜汽车之友",
            FCHECKUSE: "",
            FCHECKDATE: "",
            FNOTE:"",
            FBILLTYPE:"教学申请",
            FBILLSTATE: "申请中",
            FTYPE:"上海研学教育中心",
            FPAYTYPE:"学校收款",
            FPAYNUM:"上海莘城中学学生研学专户",
        },
        rules: {
          FUSERNUMBER:[
            { required: true, message: '请输入学籍号码', trigger: 'blur' },
          ],
          FUSER: [
            { required: true, message: '请输入申请人员', trigger: 'blur' },
          ],
          FMEMO: [
            { required: true, message: '请输入申请理由', trigger: 'blur' },
          ],
        },
      list2: [{  "FENTRYID":1,
                  "FCATNAME": "上海博物馆研学",
                  "FUNIT":"2025-04-28",
                  "FQTY":"1",
                  "FPRICE":"100",
                  "FAMT":"100",
                  "FAVG":"60",
                  "FMEMO": "曹昂"
                },
                { "FENTRYID":2,
                  "FCATNAME": "上海博物馆研学",
                  "FUNIT":"2025-04-28",
                  "FQTY":"1",
                  "FPRICE":"100",
                  "FAMT":"100",
                  "FAVG":"35",
                  "FMEMO": "曹植"
                },
                { "FENTRYID":3,
                  "FCATNAME": "上海博物馆研学",
                  "FUNIT":"2025-04-28",
                  "FQTY":"1",
                  "FPRICE":"100",
                  "FAMT":"100",
                  "FAVG":"6.9",
                  "FMEMO": "曹丕"
                },
                { "FENTRYID":4,
                  "FCATNAME": "上海博物馆研学",
                  "FUNIT":"2025-04-28",
                  "FQTY":"1",
                  "FPRICE":"100",
                  "FAMT":"100",
                  "FAVG":"1.2",
                  "FMEMO": "曹冲"
                },
                { "FENTRYID":5,
                  "FCATNAME": "上海博物馆研学",
                  "FUNIT":"2025-04-28",
                  "FQTY":"1",
                  "FPRICE":"100",
                  "FAMT":"100",
                  "FAVG":"10",
                  "FMEMO": "曹仁"
                }],
      list1: [{  "FENTRYID":1,
                  "FCATNAME": "曹昂",
                  "FCATNO":"",
                  "FNOTE":"闵行莘城中学",
                  "FMEMO": ""
                },
                { "FENTRYID":2,
                  "FCATNAME": "曹植",
                  "FCATNO":"",
                  "FNOTE":"闵行莘城中学",
                  "FMEMO": ""
                },
                { "FENTRYID":3,
                  "FCATNAME": "曹丕",
                  "FCATNO":"",
                  "FNOTE":"闵行莘城中学",
                  "FMEMO": ""
                },
                { "FENTRYID":4,
                  "FCATNAME": "曹冲",
                  "FCATNO":"",
                  "FNOTE":"闵行莘城中学",
                  "FMEMO": ""
                },
                { "FENTRYID":5,
                  "FCATNAME": "曹仁",
                  "FCATNO":"",
                  "FNOTE":"闵行莘城中学",
                  "FMEMO": ""
                }],

        loading: false,
        visible: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '申请中'
        }, {
          value: '2',
          label: '已通过'
        }, {
          value: '3',
          label: '已驳回'
        }],

        //所属校区选择数据
        options2: [{
          value: '1',
          label: '教学申请'
        }, {
          value: '2',
          label: '培训人员'
        }, {
          value: '3',
          label: '外来人员'
        }],

        options7: [{
          value: '1',
          label: '学校收款'
        }, {
          value: '2',
          label: '机构收款'
        }],

        options8: [{
          value: '1',
          label: '上海闵行区区莘城中学学杂费存取专户'
        }, {
          value: '2',
          label: '上海莘城中学学生研学专户'
        }],
        
      };
    },
    created() {
    },
    mounted() { },
    methods: {
      viewfile(id){
        console.log(id);
        if(id=="0"){
          let link = document.createElement('a');
          link.href = 'http://180.166.193.6:90/images/study/teach-20250001.pdf';
          link.target = '_blank'; // 在新窗口或新标签页中打开URL
          link.click();
        }

        if(id=="1"){
          let link = document.createElement('a');
          link.href = 'https://www.bilibili.com/video/BV1cBfpYpETw/?t=2.3';
          link.target = '_blank'; // 在新窗口或新标签页中打开URL
          link.click();
        }
      },
      closePage(){
        console.log('关闭弹窗dialog');
        this.visible = false;
      },
      init(FBILLNO) {
        this.dataForm.FBILLNO = FBILLNO;
        if (this.dataForm.FBILLNO) {
          this.title = "修改"
          this.insertorupdate = false;
        }
        else {
          this.title = "新增"
          this.dataForm.FBILLNO = "K" + Math.floor(Math.random() * 10000000) + 1;
          this.insertorupdate = true;
        }
        this.visible = true;
      },
      insert() {
        this.$refs.StudqueryFcuston.open();
      },
      shoplist(data) {
        data.forEach(item => {
          this.list.push({
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "1"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "曹操"
          },{
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "2"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "刘备"
          })
        });
      },
      //
      cancel() {
        this.$refs.elForm.resetFields();
        this.list = [];
        this.visible = false;
      },
    },
  };
</script>